package com.aaa.dao;

import com.aaa.entity.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    @Select("select p.pid,p.pname,p.picture,p.unitprice,p.place,s.count,s.damage,s.kcount from product p inner join stock s on p.sid=s.sid")
    List<Product> select();
    @Select("select p.pid,p.pname,p.picture,p.unitprice,p.content,t.tname,p.place,p.addtime,p.finishtime,p.nutrients,p.brand,s.count,v.vname from product p left join type t on p.tid=t.tid left join stock s on p.sid=s.sid left join variety v on p.vid=v.vid")
    List<Product> select2();

    @Select("select p.pid,p.pname,p.picture,p.unitprice,p.content,t.tname,p.place,p.addtime,p.finishtime,p.nutrients,p.brand,s.count,v.vname from product p left join type t on p.tid=t.tid left join stock s on p.sid=s.sid left join variety v on p.vid=v.vid where pname=#{pname}")
    List<Product> select3(String pname);
}
